/**
* Copyright (c) By zengqh.
*
* This program is just for fun or demo, in the hope that it  
* will be useful, you can redistribute it and/or modify freely.
*
* Time: 2012/08/30
* File: AnimationSceneNode.h
* Blog: http://www.cnblogs.com/zengqh/
**/

#ifndef AnimationSceneNode_h__
#define AnimationSceneNode_h__

#include "../Core/Core.h"
#include "../Core/Declare.h"
#include "SceneNode.h"

#include "AniKeyFrame.h"
#include "AnimationTrack.h"

class AnimationSceneNode : public SceneNode
{
public:
	AnimationSceneNode(
		SceneManager* scene_mgr, 
		s32 id = -1,
		s32 type = 0,
		const glm::vec3& position = glm::vec3(0.0f, 0.0f, 0.0f),
		const glm::vec3& rotation = glm::vec3(0.0f, 0.0f, 0.0f),
		const glm::vec3& scale = glm::vec3(1.0f, 1.0f, 1.0f));

	~AnimationSceneNode();

	virtual void setAnimation(AnimationTrack* track);

	virtual void onAnimation(f32 time) = 0;

	virtual void startAnim();
	virtual void stopAnim();

protected:
	AnimationTrack*				_anim;
	u32							_start_anim_time;
	u32							_curr_anim_time;
	bool						_is_anim_start;
	bool						_need_update_first_time;
};
#endif    /* AnimationSceneNode_h__ */